﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BaHuan.Common;
using BaHuan.Entities;
using BaHuan.DataLayer;

namespace BaHuan.BusinessLayer
{
    public class DonViTinhMgt
    {
        public ResultObj SaveNewDonViTinh(DonViTinh donvitinh)
        {
            ResultObj result = new ResultObj();
            donvitinh.Id = -1;
            DonViTinhDAO donvitinhDAO = new DonViTinhDAO();
            result = donvitinhDAO.SaveDonViTinh(donvitinh);

            return result;
        }

        public ResultObj UpdateDonViTinh(DonViTinh donvitinh)
        {
            ResultObj result = new ResultObj();
            DonViTinhDAO donvitinhDAO = new DonViTinhDAO();
            result = donvitinhDAO.SaveDonViTinh(donvitinh);

            return result;
        }

        public ResultObj DeleteDonViTinh(DonViTinh donvitinh)
        {
            ResultObj result = new ResultObj();
            DonViTinhDAO donvitinhDAO = new DonViTinhDAO();
            result = donvitinhDAO.DeleteDonViTinh(donvitinh);

            return result;
        }

        public ResultObj GetAllDonViTinh()
        {
            ResultObj result = new ResultObj();
            DonViTinhDAO donvitinhDAO = new DonViTinhDAO();
            result = donvitinhDAO.GetAllDonViTinh();

            return result;
        }

        public ResultObj GeDonViTinhById(DonViTinh donvitinh)
        {
            ResultObj result = new ResultObj();
            DonViTinhDAO donvitinhDAO = new DonViTinhDAO();
            result = donvitinhDAO.GetAllDonViTinhByID(donvitinh);

            return result;
        }
    }
}
